﻿Imports DTO
Imports System.Data.OleDb

Public Class ThamSoDAO
    Public Shared Function GetThamSoAll() As DataTable
        Dim sql As String = "select * from THAMSO"
        Return DatabassProvider.ExcuQuery(sql)
    End Function
    Public Shared Function SlectSoLuongTon(ByVal masach As Integer) As DataTable
        Dim sql As String = "select * from SACH where MaSach=" & masach & ""
        Return DatabassProvider.ExcuQuery(sql)
    End Function
    Public Shared Function SlectTienNoKH(ByVal makh As Integer) As DataTable
        Dim sql As String = "select * from KHACHHANG where MaKhachHang=" & makh & ""
        Return DatabassProvider.ExcuQuery(sql)
    End Function
    Public Shared Sub Update(ByVal ts As ThamSoDTO)
        Dim sql As String = "update THAMSO set SoLuongNhapItNhat=(" & ts.SoLuongNhapMin & "),LuongTonItNhat=(" & ts.LuongTonMin & "),NoKhongQua=(" & ts.NoMin & "),LuongTonSauKhiBan=(" & ts.TonSauKhiBan & "),DieuKienThu=(" & ts.DieuKienThu & ") where MaThamSo = " & ts.MaThamSo & ""
        DatabassProvider.ExcuNonQuery(sql)
    End Sub
End Class
